<template>
  <view class="myBox" :style="{height:screenHeight+'px'}" >
    <view class="top">
        <image v-if="userInfo.avatarUrl" :src="userInfo.avatarUrl" alt="">
		<image v-else src="../../static/icons/man.png" alt="">
		<view class="content">
			{{userInfo.nickName?userInfo.nickName:'微信用户'}}
		</view>
    </view>

  </view>
</template>

<script>
import {get, showModel} from '@/config/request.js'
export default {
  data () {
    return {
      userInfo: {},
	  screenHeight:""
    }
  },
  mounted () {
	this.screenHeight = uni.getSystemInfoSync().windowHeight
    const userInfoStorage =uni.getStorageSync('userInfo')
    if (userInfoStorage) {
      this.userInfo = userInfoStorage
    }else{
		this.wxGetUserInfo()
	}
  },
  methods: {
    showOpinion () {
		console.log("测试")
		  wx.navigateTo({
			url: '/pages/opinion/index'
		  })
    },
	async wxGetUserInfo(){ //第一授权获取用户信息===》按钮触发
		await this.$utils.wxGetUserInfo()
		const userInfoStorage =uni.getStorageSync('userInfo')
		this.userInfo = userInfoStorage
	}
  },
  onShow () {
  }
}
</script>

<style scoped lang="scss">
.myBox{
	position: relative;
	.top{
		position: absolute;
		width: 100px;
		height: 200px;
		top: 200rpx;
		left: 50%;
		transform: translateX(-50px);
		image{
			width: 100px;
			height: 100px;
			border-radius: 50%;
			background-color: #f1f1f1;
			border: 5px solid #4db6fc;
		}
		.content{
			width: 100%;
			text-align: center;
			font-weight: 600;
			font-size: 25px;
			margin-top: 15rpx;
		}
	}
}
</style>

